package com.cjjd.c.feature.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.cjjd.c.R;


/**
 * Created by dadagm on 17/9/11.
 */

public class ShowTwoChooseDialog extends Dialog implements View.OnClickListener {

    private Context mContext;
    private OnCloseListener listener;
    private String tittle;
    private TextView tvTittle;

    public ShowTwoChooseDialog(Context context, String tittle, OnCloseListener listener) {
        super(context, R.style.loading_dialog);

        setContentView(R.layout.dialog_show_teo_choose);

        this.mContext = context;
        this.listener = listener;
        this.tittle=tittle;
        initView();
    }

    private void initView(){
        tvTittle=(TextView)findViewById(R.id.title);
        findViewById(R.id.tv_book_search).setOnClickListener(this);
        findViewById(R.id.tv_phone_search).setOnClickListener(this);
        findViewById(R.id.quit).setOnClickListener(this);
        tvTittle.setText(tittle);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_book_search:
                listener.OnBookSearchClick();
                this.dismiss();
                break;
            case R.id.tv_phone_search:
                listener.OnPhoneSearchClick();
                this.dismiss();
                break;
            case R.id.quit:
                listener.Onclose();
                this.dismiss();
                break;
        }
    }

    public interface  OnCloseListener{

        public void OnBookSearchClick();
        public void OnPhoneSearchClick();

        public void Onclose();
    }
}
